package cn.edu.scau.cmi.hombio.web.rest;

import cn.edu.scau.cmi.hombio.dao.CureTaskCourseDAO;
import cn.edu.scau.cmi.hombio.dao.CustomerDAO;
import cn.edu.scau.cmi.hombio.dao.EmployeeDAO;
import cn.edu.scau.cmi.hombio.dao.ExceptDAO;
import cn.edu.scau.cmi.hombio.dao.FeedDAO;
import cn.edu.scau.cmi.hombio.dao.FodderTakeDAO;
import cn.edu.scau.cmi.hombio.dao.InspectionDAO;
import cn.edu.scau.cmi.hombio.dao.MedicineTakeDAO;
import cn.edu.scau.cmi.hombio.dao.PreventionDAO;
import cn.edu.scau.cmi.hombio.dao.SaleDAO;
import cn.edu.scau.cmi.hombio.dao.SaleTaskQualityDAO;
import cn.edu.scau.cmi.hombio.dao.TaskDAO;
import cn.edu.scau.cmi.hombio.dao.TaskEmployeeDAO;
import cn.edu.scau.cmi.hombio.dao.TaskIntervalCycleDAO;
import cn.edu.scau.cmi.hombio.dao.TaskManageDAO;
import cn.edu.scau.cmi.hombio.dao.TaskPigDAO;
import cn.edu.scau.cmi.hombio.dao.TaskPighouseDAO;
import cn.edu.scau.cmi.hombio.dao.TaskPigstyDAO;
import cn.edu.scau.cmi.hombio.dao.TaskPreventionDAO;
import cn.edu.scau.cmi.hombio.dao.TaskStatusTypeDAO;
import cn.edu.scau.cmi.hombio.dao.TaskTypeDAO;
import cn.edu.scau.cmi.hombio.dao.TransferDAO;

import cn.edu.scau.cmi.hombio.domain.CureTaskCourse;
import cn.edu.scau.cmi.hombio.domain.Customer;
import cn.edu.scau.cmi.hombio.domain.Employee;
import cn.edu.scau.cmi.hombio.domain.Except;
import cn.edu.scau.cmi.hombio.domain.Feed;
import cn.edu.scau.cmi.hombio.domain.FodderTake;
import cn.edu.scau.cmi.hombio.domain.Inspection;
import cn.edu.scau.cmi.hombio.domain.MedicineTake;
import cn.edu.scau.cmi.hombio.domain.Prevention;
import cn.edu.scau.cmi.hombio.domain.Sale;
import cn.edu.scau.cmi.hombio.domain.SaleTaskQuality;
import cn.edu.scau.cmi.hombio.domain.Task;
import cn.edu.scau.cmi.hombio.domain.TaskEmployee;
import cn.edu.scau.cmi.hombio.domain.TaskIntervalCycle;
import cn.edu.scau.cmi.hombio.domain.TaskManage;
import cn.edu.scau.cmi.hombio.domain.TaskPig;
import cn.edu.scau.cmi.hombio.domain.TaskPighouse;
import cn.edu.scau.cmi.hombio.domain.TaskPigsty;
import cn.edu.scau.cmi.hombio.domain.TaskPrevention;
import cn.edu.scau.cmi.hombio.domain.TaskStatusType;
import cn.edu.scau.cmi.hombio.domain.TaskType;
import cn.edu.scau.cmi.hombio.domain.Transfer;

import cn.edu.scau.cmi.hombio.service.TaskService;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.WebDataBinder;

import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Spring Rest controller that handles CRUD requests for Task entities
 * 
 */

@Controller("TaskRestController")

public class TaskRestController {

	/**
	 * DAO injected by Spring that manages CureTaskCourse entities
	 * 
	 */
	@Autowired
	private CureTaskCourseDAO cureTaskCourseDAO;

	/**
	 * DAO injected by Spring that manages Customer entities
	 * 
	 */
	@Autowired
	private CustomerDAO customerDAO;

	/**
	 * DAO injected by Spring that manages Employee entities
	 * 
	 */
	@Autowired
	private EmployeeDAO employeeDAO;

	/**
	 * DAO injected by Spring that manages Except entities
	 * 
	 */
	@Autowired
	private ExceptDAO exceptDAO;

	/**
	 * DAO injected by Spring that manages Feed entities
	 * 
	 */
	@Autowired
	private FeedDAO feedDAO;

	/**
	 * DAO injected by Spring that manages FodderTake entities
	 * 
	 */
	@Autowired
	private FodderTakeDAO fodderTakeDAO;

	/**
	 * DAO injected by Spring that manages Inspection entities
	 * 
	 */
	@Autowired
	private InspectionDAO inspectionDAO;

	/**
	 * DAO injected by Spring that manages MedicineTake entities
	 * 
	 */
	@Autowired
	private MedicineTakeDAO medicineTakeDAO;

	/**
	 * DAO injected by Spring that manages Prevention entities
	 * 
	 */
	@Autowired
	private PreventionDAO preventionDAO;

	/**
	 * DAO injected by Spring that manages Sale entities
	 * 
	 */
	@Autowired
	private SaleDAO saleDAO;

	/**
	 * DAO injected by Spring that manages SaleTaskQuality entities
	 * 
	 */
	@Autowired
	private SaleTaskQualityDAO saleTaskQualityDAO;

	/**
	 * DAO injected by Spring that manages Task entities
	 * 
	 */
	@Autowired
	private TaskDAO taskDAO;

	/**
	 * DAO injected by Spring that manages TaskEmployee entities
	 * 
	 */
	@Autowired
	private TaskEmployeeDAO taskEmployeeDAO;

	/**
	 * DAO injected by Spring that manages TaskIntervalCycle entities
	 * 
	 */
	@Autowired
	private TaskIntervalCycleDAO taskIntervalCycleDAO;

	/**
	 * DAO injected by Spring that manages TaskManage entities
	 * 
	 */
	@Autowired
	private TaskManageDAO taskManageDAO;

	/**
	 * DAO injected by Spring that manages TaskPig entities
	 * 
	 */
	@Autowired
	private TaskPigDAO taskPigDAO;

	/**
	 * DAO injected by Spring that manages TaskPighouse entities
	 * 
	 */
	@Autowired
	private TaskPighouseDAO taskPighouseDAO;

	/**
	 * DAO injected by Spring that manages TaskPigsty entities
	 * 
	 */
	@Autowired
	private TaskPigstyDAO taskPigstyDAO;

	/**
	 * DAO injected by Spring that manages TaskPrevention entities
	 * 
	 */
	@Autowired
	private TaskPreventionDAO taskPreventionDAO;

	/**
	 * DAO injected by Spring that manages TaskStatusType entities
	 * 
	 */
	@Autowired
	private TaskStatusTypeDAO taskStatusTypeDAO;

	/**
	 * DAO injected by Spring that manages TaskType entities
	 * 
	 */
	@Autowired
	private TaskTypeDAO taskTypeDAO;

	/**
	 * DAO injected by Spring that manages Transfer entities
	 * 
	 */
	@Autowired
	private TransferDAO transferDAO;

	/**
	 * Service injected by Spring that provides CRUD operations for Task entities
	 * 
	 */
	@Autowired
	private TaskService taskService;

	/**
	 * View an existing MedicineTake entity
	 * 
	 */
	@RequestMapping(value = "/Task/{task_id}/medicineTakes/{medicinetake_id}", method = RequestMethod.GET)
	@ResponseBody
	public MedicineTake loadTaskMedicineTakes(@PathVariable Integer task_id, @PathVariable Integer related_medicinetakes_id) {
		MedicineTake medicinetake = medicineTakeDAO.findMedicineTakeByPrimaryKey(related_medicinetakes_id, -1, -1);

		return medicinetake;
	}

	/**
	* Create a new Except entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/excepts", method = RequestMethod.POST)
	@ResponseBody
	public Except newTaskExcepts(@PathVariable Integer task_id, @RequestBody Except except) {
		taskService.saveTaskExcepts(task_id, except);
		return exceptDAO.findExceptByPrimaryKey(except.getId());
	}

	/**
	* Delete an existing MedicineTake entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/medicineTakes/{medicinetake_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskMedicineTakes(@PathVariable Integer task_id, @PathVariable Integer related_medicinetakes_id) {
		taskService.deleteTaskMedicineTakes(task_id, related_medicinetakes_id);
	}

	/**
	* Show all Inspection entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/inspections", method = RequestMethod.GET)
	@ResponseBody
	public List<Inspection> getTaskInspections(@PathVariable Integer task_id) {
		return new java.util.ArrayList<Inspection>(taskDAO.findTaskByPrimaryKey(task_id).getInspections());
	}

	/**
	* Delete an existing CureTaskCourse entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/cureTaskCourses/{curetaskcourse_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskCureTaskCourses(@PathVariable Integer task_id, @PathVariable Integer related_curetaskcourses_id) {
		taskService.deleteTaskCureTaskCourses(task_id, related_curetaskcourses_id);
	}

	/**
	* Create a new MedicineTake entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/medicineTakes", method = RequestMethod.POST)
	@ResponseBody
	public MedicineTake newTaskMedicineTakes(@PathVariable Integer task_id, @RequestBody MedicineTake medicinetake) {
		taskService.saveTaskMedicineTakes(task_id, medicinetake);
		return medicineTakeDAO.findMedicineTakeByPrimaryKey(medicinetake.getId());
	}

	/**
	* Show all FodderTake entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/fodderTakes", method = RequestMethod.GET)
	@ResponseBody
	public List<FodderTake> getTaskFodderTakes(@PathVariable Integer task_id) {
		return new java.util.ArrayList<FodderTake>(taskDAO.findTaskByPrimaryKey(task_id).getFodderTakes());
	}

	/**
	* View an existing Sale entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/sales/{sale_id}", method = RequestMethod.GET)
	@ResponseBody
	public Sale loadTaskSales(@PathVariable Integer task_id, @PathVariable Integer related_sales_id) {
		Sale sale = saleDAO.findSaleByPrimaryKey(related_sales_id, -1, -1);

		return sale;
	}

	/**
	* Create a new Customer entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/customer", method = RequestMethod.POST)
	@ResponseBody
	public Customer newTaskCustomer(@PathVariable Integer task_id, @RequestBody Customer customer) {
		taskService.saveTaskCustomer(task_id, customer);
		return customerDAO.findCustomerByPrimaryKey(customer.getId());
	}

	/**
	* Delete an existing FodderTake entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/fodderTakes/{foddertake_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskFodderTakes(@PathVariable Integer task_id, @PathVariable Integer related_foddertakes_id) {
		taskService.deleteTaskFodderTakes(task_id, related_foddertakes_id);
	}

	/**
	* Show all TaskPig entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPigs", method = RequestMethod.GET)
	@ResponseBody
	public List<TaskPig> getTaskTaskPigs(@PathVariable Integer task_id) {
		return new java.util.ArrayList<TaskPig>(taskDAO.findTaskByPrimaryKey(task_id).getTaskPigs());
	}

	/**
	* Save an existing Customer entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/customer", method = RequestMethod.PUT)
	@ResponseBody
	public Customer saveTaskCustomer(@PathVariable Integer task_id, @RequestBody Customer customer) {
		taskService.saveTaskCustomer(task_id, customer);
		return customerDAO.findCustomerByPrimaryKey(customer.getId());
	}

	/**
	* Delete an existing Customer entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/customer/{customer_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskCustomer(@PathVariable Integer task_id, @PathVariable Integer related_customer_id) {
		taskService.deleteTaskCustomer(task_id, related_customer_id);
	}

	/**
	* Show all TaskPigsty entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPigsties", method = RequestMethod.GET)
	@ResponseBody
	public List<TaskPigsty> getTaskTaskPigsties(@PathVariable Integer task_id) {
		return new java.util.ArrayList<TaskPigsty>(taskDAO.findTaskByPrimaryKey(task_id).getTaskPigsties());
	}

	/**
	* Delete an existing Sale entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/sales/{sale_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskSales(@PathVariable Integer task_id, @PathVariable Integer related_sales_id) {
		taskService.deleteTaskSales(task_id, related_sales_id);
	}

	/**
	* Get TaskType entity by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskType", method = RequestMethod.GET)
	@ResponseBody
	public TaskType getTaskTaskType(@PathVariable Integer task_id) {
		return taskDAO.findTaskByPrimaryKey(task_id).getTaskType();
	}

	/**
	* Delete an existing Employee entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/employee/{employee_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskEmployee(@PathVariable Integer task_id, @PathVariable Integer related_employee_id) {
		taskService.deleteTaskEmployee(task_id, related_employee_id);
	}

	/**
	* Show all Sale entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/sales", method = RequestMethod.GET)
	@ResponseBody
	public List<Sale> getTaskSales(@PathVariable Integer task_id) {
		return new java.util.ArrayList<Sale>(taskDAO.findTaskByPrimaryKey(task_id).getSales());
	}

	/**
	* View an existing SaleTaskQuality entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/saleTaskQualities/{saletaskquality_id}", method = RequestMethod.GET)
	@ResponseBody
	public SaleTaskQuality loadTaskSaleTaskQualities(@PathVariable Integer task_id, @PathVariable Integer related_saletaskqualities_id) {
		SaleTaskQuality saletaskquality = saleTaskQualityDAO.findSaleTaskQualityByPrimaryKey(related_saletaskqualities_id, -1, -1);

		return saletaskquality;
	}

	/**
	* Delete an existing Transfer entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/transfers/{transfer_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskTransfers(@PathVariable Integer task_id, @PathVariable Integer related_transfers_id) {
		taskService.deleteTaskTransfers(task_id, related_transfers_id);
	}

	/**
	* View an existing CureTaskCourse entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/cureTaskCourses/{curetaskcourse_id}", method = RequestMethod.GET)
	@ResponseBody
	public CureTaskCourse loadTaskCureTaskCourses(@PathVariable Integer task_id, @PathVariable Integer related_curetaskcourses_id) {
		CureTaskCourse curetaskcourse = cureTaskCourseDAO.findCureTaskCourseByPrimaryKey(related_curetaskcourses_id, -1, -1);

		return curetaskcourse;
	}

	/**
	* Create a new TaskManage entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskManages", method = RequestMethod.POST)
	@ResponseBody
	public TaskManage newTaskTaskManages(@PathVariable Integer task_id, @RequestBody TaskManage taskmanage) {
		taskService.saveTaskTaskManages(task_id, taskmanage);
		return taskManageDAO.findTaskManageByPrimaryKey(taskmanage.getId());
	}

	/**
	* Save an existing Sale entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/sales", method = RequestMethod.PUT)
	@ResponseBody
	public Sale saveTaskSales(@PathVariable Integer task_id, @RequestBody Sale sales) {
		taskService.saveTaskSales(task_id, sales);
		return saleDAO.findSaleByPrimaryKey(sales.getId());
	}

	/**
	* Delete an existing Feed entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/feeds/{feed_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskFeeds(@PathVariable Integer task_id, @PathVariable Integer related_feeds_id) {
		taskService.deleteTaskFeeds(task_id, related_feeds_id);
	}

	/**
	* Delete an existing Except entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/excepts/{except_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskExcepts(@PathVariable Integer task_id, @PathVariable Integer related_excepts_id) {
		taskService.deleteTaskExcepts(task_id, related_excepts_id);
	}

	/**
	* Save an existing TaskManage entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskManages", method = RequestMethod.PUT)
	@ResponseBody
	public TaskManage saveTaskTaskManages(@PathVariable Integer task_id, @RequestBody TaskManage taskmanages) {
		taskService.saveTaskTaskManages(task_id, taskmanages);
		return taskManageDAO.findTaskManageByPrimaryKey(taskmanages.getId());
	}

	/**
	* Get TaskStatusType entity by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskStatusType", method = RequestMethod.GET)
	@ResponseBody
	public TaskStatusType getTaskTaskStatusType(@PathVariable Integer task_id) {
		return taskDAO.findTaskByPrimaryKey(task_id).getTaskStatusType();
	}

	/**
	* Show all MedicineTake entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/medicineTakes", method = RequestMethod.GET)
	@ResponseBody
	public List<MedicineTake> getTaskMedicineTakes(@PathVariable Integer task_id) {
		return new java.util.ArrayList<MedicineTake>(taskDAO.findTaskByPrimaryKey(task_id).getMedicineTakes());
	}

	/**
	* Show all TaskManage entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskManages", method = RequestMethod.GET)
	@ResponseBody
	public List<TaskManage> getTaskTaskManages(@PathVariable Integer task_id) {
		return new java.util.ArrayList<TaskManage>(taskDAO.findTaskByPrimaryKey(task_id).getTaskManages());
	}

	/**
	* Save an existing Inspection entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/inspections", method = RequestMethod.PUT)
	@ResponseBody
	public Inspection saveTaskInspections(@PathVariable Integer task_id, @RequestBody Inspection inspections) {
		taskService.saveTaskInspections(task_id, inspections);
		return inspectionDAO.findInspectionByPrimaryKey(inspections.getId());
	}

	/**
	* Save an existing Except entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/excepts", method = RequestMethod.PUT)
	@ResponseBody
	public Except saveTaskExcepts(@PathVariable Integer task_id, @RequestBody Except excepts) {
		taskService.saveTaskExcepts(task_id, excepts);
		return exceptDAO.findExceptByPrimaryKey(excepts.getId());
	}

	/**
	* Delete an existing TaskType entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskType/{tasktype_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskTaskType(@PathVariable Integer task_id, @PathVariable Integer related_tasktype_id) {
		taskService.deleteTaskTaskType(task_id, related_tasktype_id);
	}

	/**
	* View an existing Inspection entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/inspections/{inspection_id}", method = RequestMethod.GET)
	@ResponseBody
	public Inspection loadTaskInspections(@PathVariable Integer task_id, @PathVariable Integer related_inspections_id) {
		Inspection inspection = inspectionDAO.findInspectionByPrimaryKey(related_inspections_id, -1, -1);

		return inspection;
	}

	/**
	* Save an existing FodderTake entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/fodderTakes", method = RequestMethod.PUT)
	@ResponseBody
	public FodderTake saveTaskFodderTakes(@PathVariable Integer task_id, @RequestBody FodderTake foddertakes) {
		taskService.saveTaskFodderTakes(task_id, foddertakes);
		return fodderTakeDAO.findFodderTakeByPrimaryKey(foddertakes.getId());
	}

	/**
	* View an existing TaskEmployee entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskEmployees/{taskemployee_id}", method = RequestMethod.GET)
	@ResponseBody
	public TaskEmployee loadTaskTaskEmployees(@PathVariable Integer task_id, @PathVariable Integer related_taskemployees_id) {
		TaskEmployee taskemployee = taskEmployeeDAO.findTaskEmployeeByPrimaryKey(related_taskemployees_id, -1, -1);

		return taskemployee;
	}

	/**
	* Select an existing Task entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}", method = RequestMethod.GET)
	@ResponseBody
	public Task loadTask(@PathVariable Integer task_id) {
		return taskDAO.findTaskByPrimaryKey(task_id);
	}

	/**
	* Create a new CureTaskCourse entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/cureTaskCourses", method = RequestMethod.POST)
	@ResponseBody
	public CureTaskCourse newTaskCureTaskCourses(@PathVariable Integer task_id, @RequestBody CureTaskCourse curetaskcourse) {
		taskService.saveTaskCureTaskCourses(task_id, curetaskcourse);
		return cureTaskCourseDAO.findCureTaskCourseByPrimaryKey(curetaskcourse.getId());
	}

	/**
	* View an existing Feed entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/feeds/{feed_id}", method = RequestMethod.GET)
	@ResponseBody
	public Feed loadTaskFeeds(@PathVariable Integer task_id, @PathVariable Integer related_feeds_id) {
		Feed feed = feedDAO.findFeedByPrimaryKey(related_feeds_id, -1, -1);

		return feed;
	}

	/**
	* Create a new FodderTake entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/fodderTakes", method = RequestMethod.POST)
	@ResponseBody
	public FodderTake newTaskFodderTakes(@PathVariable Integer task_id, @RequestBody FodderTake foddertake) {
		taskService.saveTaskFodderTakes(task_id, foddertake);
		return fodderTakeDAO.findFodderTakeByPrimaryKey(foddertake.getId());
	}

	/**
	* View an existing TaskPrevention entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPreventions/{taskprevention_id}", method = RequestMethod.GET)
	@ResponseBody
	public TaskPrevention loadTaskTaskPreventions(@PathVariable Integer task_id, @PathVariable Integer related_taskpreventions_id) {
		TaskPrevention taskprevention = taskPreventionDAO.findTaskPreventionByPrimaryKey(related_taskpreventions_id, -1, -1);

		return taskprevention;
	}

	/**
	* Show all TaskIntervalCycle entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskIntervalCycles", method = RequestMethod.GET)
	@ResponseBody
	public List<TaskIntervalCycle> getTaskTaskIntervalCycles(@PathVariable Integer task_id) {
		return new java.util.ArrayList<TaskIntervalCycle>(taskDAO.findTaskByPrimaryKey(task_id).getTaskIntervalCycles());
	}

	/**
	* Save an existing TaskEmployee entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskEmployees", method = RequestMethod.PUT)
	@ResponseBody
	public TaskEmployee saveTaskTaskEmployees(@PathVariable Integer task_id, @RequestBody TaskEmployee taskemployees) {
		taskService.saveTaskTaskEmployees(task_id, taskemployees);
		return taskEmployeeDAO.findTaskEmployeeByPrimaryKey(taskemployees.getId());
	}

	/**
	* Show all TaskPrevention entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPreventions", method = RequestMethod.GET)
	@ResponseBody
	public List<TaskPrevention> getTaskTaskPreventions(@PathVariable Integer task_id) {
		return new java.util.ArrayList<TaskPrevention>(taskDAO.findTaskByPrimaryKey(task_id).getTaskPreventions());
	}

	/**
	* Delete an existing SaleTaskQuality entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/saleTaskQualities/{saletaskquality_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskSaleTaskQualities(@PathVariable Integer task_id, @PathVariable Integer related_saletaskqualities_id) {
		taskService.deleteTaskSaleTaskQualities(task_id, related_saletaskqualities_id);
	}

	/**
	* Save an existing TaskIntervalCycle entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskIntervalCycles", method = RequestMethod.PUT)
	@ResponseBody
	public TaskIntervalCycle saveTaskTaskIntervalCycles(@PathVariable Integer task_id, @RequestBody TaskIntervalCycle taskintervalcycles) {
		taskService.saveTaskTaskIntervalCycles(task_id, taskintervalcycles);
		return taskIntervalCycleDAO.findTaskIntervalCycleByPrimaryKey(taskintervalcycles.getId());
	}

	/**
	* Delete an existing TaskIntervalCycle entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskIntervalCycles/{taskintervalcycle_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskTaskIntervalCycles(@PathVariable Integer task_id, @PathVariable Integer related_taskintervalcycles_id) {
		taskService.deleteTaskTaskIntervalCycles(task_id, related_taskintervalcycles_id);
	}

	/**
	* View an existing TaskPig entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPigs/{taskpig_id}", method = RequestMethod.GET)
	@ResponseBody
	public TaskPig loadTaskTaskPigs(@PathVariable Integer task_id, @PathVariable Integer related_taskpigs_id) {
		TaskPig taskpig = taskPigDAO.findTaskPigByPrimaryKey(related_taskpigs_id, -1, -1);

		return taskpig;
	}

	/**
	* Create a new Task entity
	* 
	*/
	@RequestMapping(value = "/Task", method = RequestMethod.POST)
	@ResponseBody
	public Task newTask(@RequestBody Task task) {
		taskService.saveTask(task);
		return taskDAO.findTaskByPrimaryKey(task.getId());
	}

	/**
	* Create a new Sale entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/sales", method = RequestMethod.POST)
	@ResponseBody
	public Sale newTaskSales(@PathVariable Integer task_id, @RequestBody Sale sale) {
		taskService.saveTaskSales(task_id, sale);
		return saleDAO.findSaleByPrimaryKey(sale.getId());
	}

	/**
	* Delete an existing TaskPigsty entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPigsties/{taskpigsty_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskTaskPigsties(@PathVariable Integer task_id, @PathVariable Integer related_taskpigsties_id) {
		taskService.deleteTaskTaskPigsties(task_id, related_taskpigsties_id);
	}

	/**
	* View an existing Transfer entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/transfers/{transfer_id}", method = RequestMethod.GET)
	@ResponseBody
	public Transfer loadTaskTransfers(@PathVariable Integer task_id, @PathVariable Integer related_transfers_id) {
		Transfer transfer = transferDAO.findTransferByPrimaryKey(related_transfers_id, -1, -1);

		return transfer;
	}

	/**
	* View an existing Employee entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/employee/{employee_id}", method = RequestMethod.GET)
	@ResponseBody
	public Employee loadTaskEmployee(@PathVariable Integer task_id, @PathVariable Integer related_employee_id) {
		Employee employee = employeeDAO.findEmployeeByPrimaryKey(related_employee_id, -1, -1);

		return employee;
	}

	/**
	* View an existing Prevention entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/preventions/{prevention_id}", method = RequestMethod.GET)
	@ResponseBody
	public Prevention loadTaskPreventions(@PathVariable Integer task_id, @PathVariable Integer related_preventions_id) {
		Prevention prevention = preventionDAO.findPreventionByPrimaryKey(related_preventions_id, -1, -1);

		return prevention;
	}

	/**
	* Show all TaskPighouse entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPighouses", method = RequestMethod.GET)
	@ResponseBody
	public List<TaskPighouse> getTaskTaskPighouses(@PathVariable Integer task_id) {
		return new java.util.ArrayList<TaskPighouse>(taskDAO.findTaskByPrimaryKey(task_id).getTaskPighouses());
	}

	/**
	* Show all Task entities
	* 
	*/
	@RequestMapping(value = "/Task", method = RequestMethod.GET)
	@ResponseBody
	public List<Task> listTasks() {
		return new java.util.ArrayList<Task>(taskService.loadTasks());
	}

	/**
	* Delete an existing TaskPig entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPigs/{taskpig_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskTaskPigs(@PathVariable Integer task_id, @PathVariable Integer related_taskpigs_id) {
		taskService.deleteTaskTaskPigs(task_id, related_taskpigs_id);
	}

	/**
	* Save an existing SaleTaskQuality entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/saleTaskQualities", method = RequestMethod.PUT)
	@ResponseBody
	public SaleTaskQuality saveTaskSaleTaskQualities(@PathVariable Integer task_id, @RequestBody SaleTaskQuality saletaskqualities) {
		taskService.saveTaskSaleTaskQualities(task_id, saletaskqualities);
		return saleTaskQualityDAO.findSaleTaskQualityByPrimaryKey(saletaskqualities.getId());
	}

	/**
	* Show all Transfer entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/transfers", method = RequestMethod.GET)
	@ResponseBody
	public List<Transfer> getTaskTransfers(@PathVariable Integer task_id) {
		return new java.util.ArrayList<Transfer>(taskDAO.findTaskByPrimaryKey(task_id).getTransfers());
	}

	/**
	* Create a new TaskPighouse entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPighouses", method = RequestMethod.POST)
	@ResponseBody
	public TaskPighouse newTaskTaskPighouses(@PathVariable Integer task_id, @RequestBody TaskPighouse taskpighouse) {
		taskService.saveTaskTaskPighouses(task_id, taskpighouse);
		return taskPighouseDAO.findTaskPighouseByPrimaryKey(taskpighouse.getId());
	}

	/**
	* Save an existing TaskStatusType entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskStatusType", method = RequestMethod.PUT)
	@ResponseBody
	public TaskStatusType saveTaskTaskStatusType(@PathVariable Integer task_id, @RequestBody TaskStatusType taskstatustype) {
		taskService.saveTaskTaskStatusType(task_id, taskstatustype);
		return taskStatusTypeDAO.findTaskStatusTypeByPrimaryKey(taskstatustype.getId());
	}

	/**
	* Create a new Feed entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/feeds", method = RequestMethod.POST)
	@ResponseBody
	public Feed newTaskFeeds(@PathVariable Integer task_id, @RequestBody Feed feed) {
		taskService.saveTaskFeeds(task_id, feed);
		return feedDAO.findFeedByPrimaryKey(feed.getId());
	}

	/**
	* Register custom, context-specific property editors
	* 
	*/
	@InitBinder
	public void initBinder(WebDataBinder binder, HttpServletRequest request) { // Register static property editors.
		binder.registerCustomEditor(java.util.Calendar.class, new org.skyway.spring.util.databinding.CustomCalendarEditor());
		binder.registerCustomEditor(byte[].class, new org.springframework.web.multipart.support.ByteArrayMultipartFileEditor());
		binder.registerCustomEditor(boolean.class, new org.skyway.spring.util.databinding.EnhancedBooleanEditor(false));
		binder.registerCustomEditor(Boolean.class, new org.skyway.spring.util.databinding.EnhancedBooleanEditor(true));
		binder.registerCustomEditor(java.math.BigDecimal.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(java.math.BigDecimal.class, true));
		binder.registerCustomEditor(Integer.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(Integer.class, true));
		binder.registerCustomEditor(java.util.Date.class, new org.skyway.spring.util.databinding.CustomDateEditor());
		binder.registerCustomEditor(String.class, new org.skyway.spring.util.databinding.StringEditor());
		binder.registerCustomEditor(Long.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(Long.class, true));
		binder.registerCustomEditor(Double.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(Double.class, true));
	}

	/**
	* Delete an existing TaskPighouse entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPighouses/{taskpighouse_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskTaskPighouses(@PathVariable Integer task_id, @PathVariable Integer related_taskpighouses_id) {
		taskService.deleteTaskTaskPighouses(task_id, related_taskpighouses_id);
	}

	/**
	* Save an existing Employee entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/employee", method = RequestMethod.PUT)
	@ResponseBody
	public Employee saveTaskEmployee(@PathVariable Integer task_id, @RequestBody Employee employee) {
		taskService.saveTaskEmployee(task_id, employee);
		return employeeDAO.findEmployeeByPrimaryKey(employee.getId());
	}

	/**
	* Delete an existing TaskPrevention entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPreventions/{taskprevention_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskTaskPreventions(@PathVariable Integer task_id, @PathVariable Integer related_taskpreventions_id) {
		taskService.deleteTaskTaskPreventions(task_id, related_taskpreventions_id);
	}

	/**
	* View an existing TaskPighouse entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPighouses/{taskpighouse_id}", method = RequestMethod.GET)
	@ResponseBody
	public TaskPighouse loadTaskTaskPighouses(@PathVariable Integer task_id, @PathVariable Integer related_taskpighouses_id) {
		TaskPighouse taskpighouse = taskPighouseDAO.findTaskPighouseByPrimaryKey(related_taskpighouses_id, -1, -1);

		return taskpighouse;
	}

	/**
	* Create a new TaskEmployee entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskEmployees", method = RequestMethod.POST)
	@ResponseBody
	public TaskEmployee newTaskTaskEmployees(@PathVariable Integer task_id, @RequestBody TaskEmployee taskemployee) {
		taskService.saveTaskTaskEmployees(task_id, taskemployee);
		return taskEmployeeDAO.findTaskEmployeeByPrimaryKey(taskemployee.getId());
	}

	/**
	* Save an existing TaskPigsty entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPigsties", method = RequestMethod.PUT)
	@ResponseBody
	public TaskPigsty saveTaskTaskPigsties(@PathVariable Integer task_id, @RequestBody TaskPigsty taskpigsties) {
		taskService.saveTaskTaskPigsties(task_id, taskpigsties);
		return taskPigstyDAO.findTaskPigstyByPrimaryKey(taskpigsties.getId());
	}

	/**
	* Save an existing TaskPrevention entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPreventions", method = RequestMethod.PUT)
	@ResponseBody
	public TaskPrevention saveTaskTaskPreventions(@PathVariable Integer task_id, @RequestBody TaskPrevention taskpreventions) {
		taskService.saveTaskTaskPreventions(task_id, taskpreventions);
		return taskPreventionDAO.findTaskPreventionByPrimaryKey(taskpreventions.getId());
	}

	/**
	* Save an existing TaskType entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskType", method = RequestMethod.PUT)
	@ResponseBody
	public TaskType saveTaskTaskType(@PathVariable Integer task_id, @RequestBody TaskType tasktype) {
		taskService.saveTaskTaskType(task_id, tasktype);
		return taskTypeDAO.findTaskTypeByPrimaryKey(tasktype.getId());
	}

	/**
	* Delete an existing TaskStatusType entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskStatusType/{taskstatustype_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskTaskStatusType(@PathVariable Integer task_id, @PathVariable Integer related_taskstatustype_id) {
		taskService.deleteTaskTaskStatusType(task_id, related_taskstatustype_id);
	}

	/**
	* View an existing TaskType entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskType/{tasktype_id}", method = RequestMethod.GET)
	@ResponseBody
	public TaskType loadTaskTaskType(@PathVariable Integer task_id, @PathVariable Integer related_tasktype_id) {
		TaskType tasktype = taskTypeDAO.findTaskTypeByPrimaryKey(related_tasktype_id, -1, -1);

		return tasktype;
	}

	/**
	* Show all Feed entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/feeds", method = RequestMethod.GET)
	@ResponseBody
	public List<Feed> getTaskFeeds(@PathVariable Integer task_id) {
		return new java.util.ArrayList<Feed>(taskDAO.findTaskByPrimaryKey(task_id).getFeeds());
	}

	/**
	* Save an existing MedicineTake entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/medicineTakes", method = RequestMethod.PUT)
	@ResponseBody
	public MedicineTake saveTaskMedicineTakes(@PathVariable Integer task_id, @RequestBody MedicineTake medicinetakes) {
		taskService.saveTaskMedicineTakes(task_id, medicinetakes);
		return medicineTakeDAO.findMedicineTakeByPrimaryKey(medicinetakes.getId());
	}

	/**
	* View an existing Customer entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/customer/{customer_id}", method = RequestMethod.GET)
	@ResponseBody
	public Customer loadTaskCustomer(@PathVariable Integer task_id, @PathVariable Integer related_customer_id) {
		Customer customer = customerDAO.findCustomerByPrimaryKey(related_customer_id, -1, -1);

		return customer;
	}

	/**
	* Create a new Employee entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/employee", method = RequestMethod.POST)
	@ResponseBody
	public Employee newTaskEmployee(@PathVariable Integer task_id, @RequestBody Employee employee) {
		taskService.saveTaskEmployee(task_id, employee);
		return employeeDAO.findEmployeeByPrimaryKey(employee.getId());
	}

	/**
	* Show all Except entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/excepts", method = RequestMethod.GET)
	@ResponseBody
	public List<Except> getTaskExcepts(@PathVariable Integer task_id) {
		return new java.util.ArrayList<Except>(taskDAO.findTaskByPrimaryKey(task_id).getExcepts());
	}

	/**
	* View an existing FodderTake entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/fodderTakes/{foddertake_id}", method = RequestMethod.GET)
	@ResponseBody
	public FodderTake loadTaskFodderTakes(@PathVariable Integer task_id, @PathVariable Integer related_foddertakes_id) {
		FodderTake foddertake = fodderTakeDAO.findFodderTakeByPrimaryKey(related_foddertakes_id, -1, -1);

		return foddertake;
	}

	/**
	* View an existing TaskPigsty entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPigsties/{taskpigsty_id}", method = RequestMethod.GET)
	@ResponseBody
	public TaskPigsty loadTaskTaskPigsties(@PathVariable Integer task_id, @PathVariable Integer related_taskpigsties_id) {
		TaskPigsty taskpigsty = taskPigstyDAO.findTaskPigstyByPrimaryKey(related_taskpigsties_id, -1, -1);

		return taskpigsty;
	}

	/**
	* Create a new TaskIntervalCycle entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskIntervalCycles", method = RequestMethod.POST)
	@ResponseBody
	public TaskIntervalCycle newTaskTaskIntervalCycles(@PathVariable Integer task_id, @RequestBody TaskIntervalCycle taskintervalcycle) {
		taskService.saveTaskTaskIntervalCycles(task_id, taskintervalcycle);
		return taskIntervalCycleDAO.findTaskIntervalCycleByPrimaryKey(taskintervalcycle.getId());
	}

	/**
	* Get Customer entity by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/customer", method = RequestMethod.GET)
	@ResponseBody
	public Customer getTaskCustomer(@PathVariable Integer task_id) {
		return taskDAO.findTaskByPrimaryKey(task_id).getCustomer();
	}

	/**
	* Save an existing CureTaskCourse entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/cureTaskCourses", method = RequestMethod.PUT)
	@ResponseBody
	public CureTaskCourse saveTaskCureTaskCourses(@PathVariable Integer task_id, @RequestBody CureTaskCourse curetaskcourses) {
		taskService.saveTaskCureTaskCourses(task_id, curetaskcourses);
		return cureTaskCourseDAO.findCureTaskCourseByPrimaryKey(curetaskcourses.getId());
	}

	/**
	* Save an existing Transfer entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/transfers", method = RequestMethod.PUT)
	@ResponseBody
	public Transfer saveTaskTransfers(@PathVariable Integer task_id, @RequestBody Transfer transfers) {
		taskService.saveTaskTransfers(task_id, transfers);
		return transferDAO.findTransferByPrimaryKey(transfers.getId());
	}

	/**
	* Delete an existing TaskEmployee entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskEmployees/{taskemployee_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskTaskEmployees(@PathVariable Integer task_id, @PathVariable Integer related_taskemployees_id) {
		taskService.deleteTaskTaskEmployees(task_id, related_taskemployees_id);
	}

	/**
	* View an existing Except entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/excepts/{except_id}", method = RequestMethod.GET)
	@ResponseBody
	public Except loadTaskExcepts(@PathVariable Integer task_id, @PathVariable Integer related_excepts_id) {
		Except except = exceptDAO.findExceptByPrimaryKey(related_excepts_id, -1, -1);

		return except;
	}

	/**
	* Save an existing Task entity
	* 
	*/
	@RequestMapping(value = "/Task", method = RequestMethod.PUT)
	@ResponseBody
	public Task saveTask(@RequestBody Task task) {
		taskService.saveTask(task);
		return taskDAO.findTaskByPrimaryKey(task.getId());
	}

	/**
	* Show all Prevention entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/preventions", method = RequestMethod.GET)
	@ResponseBody
	public List<Prevention> getTaskPreventions(@PathVariable Integer task_id) {
		return new java.util.ArrayList<Prevention>(taskDAO.findTaskByPrimaryKey(task_id).getPreventions());
	}

	/**
	* Create a new TaskPigsty entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPigsties", method = RequestMethod.POST)
	@ResponseBody
	public TaskPigsty newTaskTaskPigsties(@PathVariable Integer task_id, @RequestBody TaskPigsty taskpigsty) {
		taskService.saveTaskTaskPigsties(task_id, taskpigsty);
		return taskPigstyDAO.findTaskPigstyByPrimaryKey(taskpigsty.getId());
	}

	/**
	* Create a new Prevention entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/preventions", method = RequestMethod.POST)
	@ResponseBody
	public Prevention newTaskPreventions(@PathVariable Integer task_id, @RequestBody Prevention prevention) {
		taskService.saveTaskPreventions(task_id, prevention);
		return preventionDAO.findPreventionByPrimaryKey(prevention.getId());
	}

	/**
	* View an existing TaskManage entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskManages/{taskmanage_id}", method = RequestMethod.GET)
	@ResponseBody
	public TaskManage loadTaskTaskManages(@PathVariable Integer task_id, @PathVariable Integer related_taskmanages_id) {
		TaskManage taskmanage = taskManageDAO.findTaskManageByPrimaryKey(related_taskmanages_id, -1, -1);

		return taskmanage;
	}

	/**
	* Create a new SaleTaskQuality entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/saleTaskQualities", method = RequestMethod.POST)
	@ResponseBody
	public SaleTaskQuality newTaskSaleTaskQualities(@PathVariable Integer task_id, @RequestBody SaleTaskQuality saletaskquality) {
		taskService.saveTaskSaleTaskQualities(task_id, saletaskquality);
		return saleTaskQualityDAO.findSaleTaskQualityByPrimaryKey(saletaskquality.getId());
	}

	/**
	* Create a new Transfer entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/transfers", method = RequestMethod.POST)
	@ResponseBody
	public Transfer newTaskTransfers(@PathVariable Integer task_id, @RequestBody Transfer transfer) {
		taskService.saveTaskTransfers(task_id, transfer);
		return transferDAO.findTransferByPrimaryKey(transfer.getId());
	}

	/**
	* Delete an existing Prevention entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/preventions/{prevention_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskPreventions(@PathVariable Integer task_id, @PathVariable Integer related_preventions_id) {
		taskService.deleteTaskPreventions(task_id, related_preventions_id);
	}

	/**
	* Save an existing Prevention entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/preventions", method = RequestMethod.PUT)
	@ResponseBody
	public Prevention saveTaskPreventions(@PathVariable Integer task_id, @RequestBody Prevention preventions) {
		taskService.saveTaskPreventions(task_id, preventions);
		return preventionDAO.findPreventionByPrimaryKey(preventions.getId());
	}

	/**
	* Delete an existing Task entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTask(@PathVariable Integer task_id) {
		Task task = taskDAO.findTaskByPrimaryKey(task_id);
		taskService.deleteTask(task);
	}

	/**
	* Create a new TaskStatusType entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskStatusType", method = RequestMethod.POST)
	@ResponseBody
	public TaskStatusType newTaskTaskStatusType(@PathVariable Integer task_id, @RequestBody TaskStatusType taskstatustype) {
		taskService.saveTaskTaskStatusType(task_id, taskstatustype);
		return taskStatusTypeDAO.findTaskStatusTypeByPrimaryKey(taskstatustype.getId());
	}

	/**
	* Create a new TaskPrevention entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPreventions", method = RequestMethod.POST)
	@ResponseBody
	public TaskPrevention newTaskTaskPreventions(@PathVariable Integer task_id, @RequestBody TaskPrevention taskprevention) {
		taskService.saveTaskTaskPreventions(task_id, taskprevention);
		return taskPreventionDAO.findTaskPreventionByPrimaryKey(taskprevention.getId());
	}

	/**
	* Show all CureTaskCourse entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/cureTaskCourses", method = RequestMethod.GET)
	@ResponseBody
	public List<CureTaskCourse> getTaskCureTaskCourses(@PathVariable Integer task_id) {
		return new java.util.ArrayList<CureTaskCourse>(taskDAO.findTaskByPrimaryKey(task_id).getCureTaskCourses());
	}

	/**
	* Save an existing TaskPig entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPigs", method = RequestMethod.PUT)
	@ResponseBody
	public TaskPig saveTaskTaskPigs(@PathVariable Integer task_id, @RequestBody TaskPig taskpigs) {
		taskService.saveTaskTaskPigs(task_id, taskpigs);
		return taskPigDAO.findTaskPigByPrimaryKey(taskpigs.getId());
	}

	/**
	* View an existing TaskIntervalCycle entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskIntervalCycles/{taskintervalcycle_id}", method = RequestMethod.GET)
	@ResponseBody
	public TaskIntervalCycle loadTaskTaskIntervalCycles(@PathVariable Integer task_id, @PathVariable Integer related_taskintervalcycles_id) {
		TaskIntervalCycle taskintervalcycle = taskIntervalCycleDAO.findTaskIntervalCycleByPrimaryKey(related_taskintervalcycles_id, -1, -1);

		return taskintervalcycle;
	}

	/**
	* View an existing TaskStatusType entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskStatusType/{taskstatustype_id}", method = RequestMethod.GET)
	@ResponseBody
	public TaskStatusType loadTaskTaskStatusType(@PathVariable Integer task_id, @PathVariable Integer related_taskstatustype_id) {
		TaskStatusType taskstatustype = taskStatusTypeDAO.findTaskStatusTypeByPrimaryKey(related_taskstatustype_id, -1, -1);

		return taskstatustype;
	}

	/**
	* Delete an existing TaskManage entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskManages/{taskmanage_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskTaskManages(@PathVariable Integer task_id, @PathVariable Integer related_taskmanages_id) {
		taskService.deleteTaskTaskManages(task_id, related_taskmanages_id);
	}

	/**
	* Create a new TaskType entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskType", method = RequestMethod.POST)
	@ResponseBody
	public TaskType newTaskTaskType(@PathVariable Integer task_id, @RequestBody TaskType tasktype) {
		taskService.saveTaskTaskType(task_id, tasktype);
		return taskTypeDAO.findTaskTypeByPrimaryKey(tasktype.getId());
	}

	/**
	* Create a new Inspection entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/inspections", method = RequestMethod.POST)
	@ResponseBody
	public Inspection newTaskInspections(@PathVariable Integer task_id, @RequestBody Inspection inspection) {
		taskService.saveTaskInspections(task_id, inspection);
		return inspectionDAO.findInspectionByPrimaryKey(inspection.getId());
	}

	/**
	* Show all SaleTaskQuality entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/saleTaskQualities", method = RequestMethod.GET)
	@ResponseBody
	public List<SaleTaskQuality> getTaskSaleTaskQualities(@PathVariable Integer task_id) {
		return new java.util.ArrayList<SaleTaskQuality>(taskDAO.findTaskByPrimaryKey(task_id).getSaleTaskQualities());
	}

	/**
	* Save an existing TaskPighouse entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPighouses", method = RequestMethod.PUT)
	@ResponseBody
	public TaskPighouse saveTaskTaskPighouses(@PathVariable Integer task_id, @RequestBody TaskPighouse taskpighouses) {
		taskService.saveTaskTaskPighouses(task_id, taskpighouses);
		return taskPighouseDAO.findTaskPighouseByPrimaryKey(taskpighouses.getId());
	}

	/**
	* Create a new TaskPig entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskPigs", method = RequestMethod.POST)
	@ResponseBody
	public TaskPig newTaskTaskPigs(@PathVariable Integer task_id, @RequestBody TaskPig taskpig) {
		taskService.saveTaskTaskPigs(task_id, taskpig);
		return taskPigDAO.findTaskPigByPrimaryKey(taskpig.getId());
	}

	/**
	* Show all TaskEmployee entities by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/taskEmployees", method = RequestMethod.GET)
	@ResponseBody
	public List<TaskEmployee> getTaskTaskEmployees(@PathVariable Integer task_id) {
		return new java.util.ArrayList<TaskEmployee>(taskDAO.findTaskByPrimaryKey(task_id).getTaskEmployees());
	}

	/**
	* Get Employee entity by Task
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/employee", method = RequestMethod.GET)
	@ResponseBody
	public Employee getTaskEmployee(@PathVariable Integer task_id) {
		return taskDAO.findTaskByPrimaryKey(task_id).getEmployee();
	}

	/**
	* Save an existing Feed entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/feeds", method = RequestMethod.PUT)
	@ResponseBody
	public Feed saveTaskFeeds(@PathVariable Integer task_id, @RequestBody Feed feeds) {
		taskService.saveTaskFeeds(task_id, feeds);
		return feedDAO.findFeedByPrimaryKey(feeds.getId());
	}

	/**
	* Delete an existing Inspection entity
	* 
	*/
	@RequestMapping(value = "/Task/{task_id}/inspections/{inspection_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteTaskInspections(@PathVariable Integer task_id, @PathVariable Integer related_inspections_id) {
		taskService.deleteTaskInspections(task_id, related_inspections_id);
	}
}